/*
 * BloqueRss.h
 *
 *  Created on: 02/05/2014
 *      Author: ariel
 */

#ifndef BLOQUERSS_H_
#define BLOQUERSS_H_
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#include "ElementoRss.h"
#include "../../physical_layer/Block.h"
#include "../entities/Rss.h"

class BloqueRss {
public:
	int id;
	int capacity;
	int tam_dispersion;
	vector<ElementoRss*> elements;

public:
	BloqueRss();
	BloqueRss(int, int);
	virtual ~BloqueRss();

	void addElemento(ElementoRss*);
	void deleteElemento(ElementoRss*);
	bool isFreed();
	bool isBusy();
	bool existElemento(Rss* registro);
	void duplicate_tamDispersion();
	void reducirMitad_tamDispersion();
	void markelements_asFree();
	void markElemento_asBusy(ElementoRss*);
	ElementoRss* getElemento(Rss* registro);
	void initializeelements_asFreed();

	friend ostream& operator<<(ostream &o, const BloqueRss &b);

	int getCapacity();
	void setCapacity(int capacity);

	int getId();
	void setId(int id);
	int getTamDispersion();
	void setTamDispersion(int tamDispersion);

	vector<ElementoRss*> getelements();
	void setelements(vector<ElementoRss*>);

	virtual std::string serialize();
	virtual void unserialize(std::string &buffer);
	virtual int getDataSize();
};

#endif /* BLOQUERSS_H_ */
